package com.inet.test01;


import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

/**
 * 客户端：多次发送数据
 * 服务端：接收数据并打印
 * @Author weijingchen
 * @Date 2025/6/26 14:31
 * @Version 1.0.0
 */
public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",10201);
        Scanner sc = new Scanner(System.in);
        OutputStream os = socket.getOutputStream();
        while (true) {
            System.out.println("请输入数据：");
            String line = sc.nextLine();
            os.write(line.getBytes());
            if ("886".equals(line)||"bye".equalsIgnoreCase(line)){
                break;
            }
        }


        os.close();
        socket.close();
    }
}
